From e80c00aa787316a5080496b47418d91eaf3dccf5 Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Fri, 8 Dec 2006 09:19:37 +0000 Subject: [PATCH] [LINUX] Clean up and clarify find_unbound_irq(). Signed-off-by: Keir Fraser --- .../drivers/xen/core/evtchn.c | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c b/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c index d596da3888..445cacf785 100644 --- a/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c +++ b/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c @@ -244,24 +244,22 @@ asmlinkage void evtchn_do_upcall(struct pt_regs *regs) static int find_unbound_irq(void) { - int irq; + static int warned; + int dynirq, irq; - /* Only allocate from dynirq range */ - for (irq = DYNIRQ_BASE; irq < NR_IRQS; irq++) + for (dynirq = 0; dynirq < NR_DYNIRQS; dynirq++) { + irq = dynirq_to_irq(dynirq); if (irq_bindcount[irq] == 0) - break; + return irq; + } - if (irq == NR_IRQS) { - static int warned; - if (!warned) { - warned = 1; - printk(KERN_WARNING "No available IRQ to bind to: " - "increase NR_IRQS!\n"); - } - return -ENOSPC; + if (!warned) { + warned = 1; + printk(KERN_WARNING "No available IRQ to bind to: " + "increase NR_DYNIRQS.\n"); } - return irq; + return -ENOSPC; } static int bind_evtchn_to_irq(unsigned int evtchn) -- 2.30.2